package com.skyworth.demo.startactivity;

import android.app.Activity;
import android.os.*;
import android.os.Process;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class Main2Activity extends Activity {
    public static Main2Activity activity = null;

    public static void postOnUiThread(Runnable r) {
        activity.runOnUiThread(r);
    }

    private LiteUpgradeService.MyStub stub = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        activity = this;
        stub = new LiteUpgradeService.MyStub(this);
        super.onCreate(savedInstanceState);


        LinearLayout root = new LinearLayout(this);
        Button btn = new Button(this);
        btn.setText("check");
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                stub.checkUpgrade();
            }
        });
        root.addView(btn);


        btn = new Button(this);
        btn.setText("quit");
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                android.os.Process.killProcess(Process.myPid());
            }
        });
        root.addView(btn);
        setContentView(root);
    }
}
